/**
 * 
 */
package fr.univ_tln.inf9.exaplanning.controleur.cours;

import java.util.Date;

import fr.univ_tln.inf9.exaplanning.api.cours.MetaTimeSlot;

/**
 * @author ventura
 *
 */
public class MetaTimeSlotController {
	
	public MetaTimeSlotView listView = null;
	
	private MetaTimeSlot metaTimeSlot = null;
	
	public MetaTimeSlotController (MetaTimeSlot metaTimeSlot){
		this.metaTimeSlot = metaTimeSlot;
		
		addListenersToId();
		addListenersToStart_date();
		addListenersToEnd_date();
		addListenersToTerm();
		addListenersToTypeS();
	}
		
		private void addListenersToId() {
			metaTimeSlot.addIdListener(listView);			
		}
		
		private void addListenersToStart_date() {
			metaTimeSlot.addStart_dateListener(listView);			
		}
		
		private void addListenersToEnd_date() {
			metaTimeSlot.addEnd_dateListener(listView);			
		}
		
		private void addListenersToTerm() {
			metaTimeSlot.addTermListener(listView);			
		}
		
		private void addListenersToTypeS() {
			metaTimeSlot.addTypeSListener(listView);			
		}
		
		public void displayViews(){
			listView.display();
		}
		
		public void closeViews(){
			listView.close();
		}
		
		public void notifyIdChanged(int id){
			metaTimeSlot.setId(id);
		}
		
		public void notifyStart_dateChanged(Date start_date){
			metaTimeSlot.setStart_date(start_date);
		}
		
		public void notifyEnd_dateChanged(Date end_date){
			metaTimeSlot.setEnd_date(end_date);
		}
		
		public void notifyTermChanged(int term){
			metaTimeSlot.setTerm(term);
		}
		
		public void notifyTypeSChanged(MetaTimeSlot.TypeSlot typeS){
			metaTimeSlot.setTypeS(typeS);
		}
}


